package com.changgou.goods.feign;

import com.changgou.goods.pojo.Sku;
import entity.Result;
import io.swagger.annotations.ApiParam;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;

@FeignClient("goods")
@RequestMapping("/sku")
public interface SkuFeign {

    /***
     *
     * @param status
     * @return
     */
    @GetMapping("/status/{status}")
    Result<List<Sku>> findByStatus(@PathVariable String status);
    @GetMapping
    Result<List<Sku>> findAll();

    /**
     * 根据条件搜索
     * @param sku
     * @return
     */
    @PostMapping(value = "/search" )
    public Result<List<Sku>> findList(@RequestBody (required = false)  Sku sku);

    /***
     * 根据id查询商品的详情信息
     * @param id
     * @return
     */
    @GetMapping("/{id}")
    Result<Sku> findById(@PathVariable Long id);

    @GetMapping(value = "/decr/count")
    public Result decrCount(@RequestParam Map<String, Integer> decrmap);

    /***
     * 根据id修改对象
     * @param sku
     * @param id
     * @return
     */
    @PutMapping(value="/{id}")
    public Result update(@RequestBody @ApiParam(name = "Sku对象",value = "传入JSON数据",required = false) Sku sku,@PathVariable Long id);
}
